package com.ddc.study.feature.query;

import com.ddc.study.entity.Article;
import com.ddc.study.entity.History;
import com.ddc.study.entity.HotKey;
import com.ddc.study.entity.MainData;
import com.ddc.study.net.NetworkUtil;

import java.util.List;

import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

/**
 * Created on 2018/5/9.
 *
 * @author lshun
 * @version 1.0
 */
public class QueryModel implements QueryContract.IModel {
    @Nullable
    @Override
    public List<HotKey> loadHotKey() {
        return NetworkUtil.getHotKey();
    }

    @Nullable
    @Override
    public List<History> loadHistory() {
        return null;
    }

    @Override
    public long handleKeywordToHistory(String keyword) {
        //如果存在更新时间成最新  不存在则新增
        return -1;
    }

    @Nullable
    @Override
    public MainData<Article> queryWord(@IntRange(from = 0) int page, String word) {
        return NetworkUtil.queryKey(page, word);
    }

    @Override
    public boolean deleteWord(@NonNull String word) {
        return false;
    }

    @Override
    public boolean deleteAllWords() {
        return false;
    }
}
